<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript">
$(function(){
	$.session.remove("is_login");
	
});
function login_open(){
	layer.open({
		title:['登录订餐账号','height: 50px;line-height: 50px;background: #F7F7F7;color:#777777;font-weight: bolder;font-size:18px;'],
		type:1,
		area:['400px','460px'],
		content:$("#login_open")
	});
}

function login_open_admin(){
	layer.open({
		title:['管理员账号登录','height: 50px;line-height: 50px;background: #F7F7F7;color:#777777;font-weight: bolder;font-size:18px;'],
		type:1,
		area:['400px','460px'],
		content:$("#login_open_admin")
	});
}

function login_open_login(){
	var name = $("#txt_name").val();
	var pw = $("#txt_pw").val();
	if(name == ""){
		layer.alert("用户名不能为空!",
				{
					title:"提示",
					icon:5
				});
		return;
	}
	if(pw == ""){
		layer.alert("密码不能为空!",
				{
					title:"提示",
					icon:5
				});
		return;
	}
	var wait = layer.load(3);
	$.post("layerLogin",
			{
				"user.loginName":name,
				"user.loginPassword":pw
			},function(data){
				
				layer.close(wait);
				if(data == "OK"){
					location.href="index";
				}else if(data == "ERROR_USER"){
					layer.alert("用户名或密码错误!",
							{
								title:"提示",
								icon:5
							});
				}else{
					layer.alert("未知错误!",
							{
								title:"提示",
								icon:5
							});
				}
					
			});
}
function login_open_login_admin(){
	var name = $("#txt_name_admin").val();
	var pw = $("#txt_pw_admin").val();
	if(name == ""){
		layer.alert("用户名不能为空!",
				{
					title:"提示",
					icon:5
				});
		return;
	}
	if(pw == ""){
		layer.alert("密码不能为空!",
				{
					title:"提示",
					icon:5
				});
		return;
	}
	var wait = layer.load(3);
	$.post("admin/layerLogin",
			{
				"admin.loginName":name,
				"admin.loginPassword":pw
			},function(data){
				
				layer.close(wait);
				if(data == "OK"){
					location.href="admin/index";
				}else if(data == "ERROR_USER"){
					layer.alert("用户名或密码错误!",
							{
								title:"提示",
								icon:5
							});
				}else{
					layer.alert("未知错误!",
							{
								title:"提示",
								icon:5
							});
				}
					
			});
}
</script>
</head>
<body>
		<div id="header_log_img">
			<img alt="" src="image/header_log.png" />
			网上订餐系统
		</div>
		
		<div id="header_navigation">
		
				<ul id="header_ul">
					<li>|&nbsp;<a href="index">网站首页</a>&nbsp;</li>
					<li>|&nbsp;<a href="user/add_user.jsp">用户注册</a>&nbsp;</li>
					<li>|&nbsp;<a href="javaScript:" onclick="login_open()">用户登录</a>&nbsp;</li>
					<li>|&nbsp;<a href="javaScript:" onclick="login_open_admin()">管理员登录</a>&nbsp;|</li>
				</ul>
				
				<div id="login_open">
					<div id="login_open_form">
						<div class="login_open_form_item">
							<input type="text" id="txt_name" placeholder="用户名"/>
						</div>
						<div class="login_open_form_item">
							<input type="password" id="txt_pw" placeholder="密码"/>
						</div>
						<div id="login_open_form_submit">
							<input type="submit" value="登录" onclick="login_open_login()"/>
						</div>
						<div id="login_open_form_new_user"><a href="user/add_user.jsp">立即注册</a></div>
					</div>
				</div>
				
				<div id="login_open_admin">
					<div id="login_open_form_admin">
						<div class="login_open_form_item_admin">
							<input type="text" id="txt_name_admin" placeholder="管理员名"/>
						</div>
						<div class="login_open_form_item_admin">
							<input type="password" id="txt_pw_admin" placeholder="密码"/>
						</div>
						<div id="login_open_form_submit_admin">
							<input type="submit" value="登录" onclick="login_open_login_admin()"/>
						</div>
					</div>
				</div>
		</div>
		
		<div id="header_line"></div>
</body>
</html>